package com.alex.core.orderUtils;

import com.ddcx.maths.BigDecimalUtil;

/**
 * @author: xc
 * @ClassName: CarRefundMoney
 * @Date: 2019/12/27 16:40
 * @Description: 汽车退款工具类
 */
public class CarRefundMoneyUtils {
    public static int carRefundElectricity(int electricityNum,int electricityMoney, int serviceNum,int useDeg,int serviceMoney,int offerNum,int offerMoney,
                                             int chargingPrepaidMoney) {
        int refundMoney = 0;
        if (useDeg > 0) {
            //(电费+服务费-优惠非(每度))
            //电费
            double electricityCost =  electricityMoney / electricityNum;
            //服务费
            double serviceCost = serviceMoney / serviceNum;
            //优惠金额
            double offerCost =  offerMoney / offerNum;
            //计算出每度电的金额
            double electricityAmount = electricityCost+ serviceCost - offerCost;
            //这里使用电量的费用乘了100,所以要除去100
            double countElectricity = useDeg * electricityAmount;
            double refundMoneys = chargingPrepaidMoney - (countElectricity/100);
            //订单金额减去应支付金额等应退金额
            refundMoney = BigDecimalUtil.doubleFormatDown(refundMoneys).intValue();
        } else {
            refundMoney = chargingPrepaidMoney;
        }
        return refundMoney;
    }
}
